<template>
  <div class="offline-bookstore">
    <!-- 线下书店 -->
    <!-- 头部 -->
    <van-nav-bar
      title=" 线下书店"
      @click-left="onClickLeft"
      @click-right="onClickRight"
    >
      <template #left>
        <img src="@/assets/images/线下书店/xxsd-1@2x.png" alt="" class="left" />
        <span class="back">返回</span>
      </template>
      <template #right>
        <img
          src="@/assets/images/线下书店/xxsd-2@2x.png"
          alt=""
          class="share"
          @select="onSelect"
        />
      </template>
    </van-nav-bar>
    <!-- 分享 -->
    <van-share-sheet
      v-model:show="showShare"
      title="立即分享给好友"
      :options="options"
      @select="copyUrl"
    />
    <!-- 轮播图 -->
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="value of slideshowList" :key="value.imgUrl">
        <img :src="value.imgUrl" alt="" />
      </van-swipe-item>
      <template #indicator="{ active }">
        <div class="custom-indicator">{{ active + 1 }}/2</div>
      </template>
    </van-swipe>
    <!-- 樊登书店 -->
    <section class="bookstore">
      <h2>樊 登 書 店</h2>
      <div class="little-big-little">
        <div class="little"></div>
        <div class="big"></div>
        <div class="little"></div>
      </div>
      <!-- 服务中心 -->
      <ul class="serve">
        <li>服务中心</li>
        <li>社交中心</li>
        <li>分享中心</li>
        <li>学习中心</li>
      </ul>
      <p>
        樊登书店是樊登读书旗下的书店品牌，现有215
        家加盟店，3家直营店，覆盖全国30个省和103
        个城市，多年来持续为书友输出作者签售、线下 活动与丰富课程
      </p>
      <p>
        我们有着樊登读书的互联网社群知识基因，秉承
        “一间樊登书店，点亮一个社区”的理念。我们
        不仅售卖优质书籍，更致力于满足大众对线下阅
        读、个人成长、社交分享的需求，为3亿国人打
        造学习、文化、生活美学的“第三空间”。
      </p>
      <p>
        欢迎大家加入到这一份点亮自己和他人的事业中
        来。愿每一位书友，都能在樊登书店遇见灵感之光。
      </p>
      <!-- 三张图片 -->
      <div class="three-pic">
        <img src="@/assets/images/线下书店/xxsd-4@2x.png" alt="" class="left" />
        <img
          src="@/assets/images/线下书店/xxsd-5@2x.png"
          alt=""
          class="center"
        />
        <img
          src="@/assets/images/线下书店/xxsd-6@2x.png"
          alt=""
          class="right"
        />
      </div>
      <!-- 大图 -->
      <figure class="big-img">
        <img src="@/assets/images/线下书店/xxsd-7@2x.png" alt="" />
      </figure>
      <!-- 服务业态 -->
      <h2>服务业态</h2>
      <div class="little-big-little bottom">
        <div class="little"></div>
        <div class="big"></div>
        <div class="little"></div>
      </div>
      <ul class="manner">
        <li>
          <img src="@/assets/images/线下书店/xxsd-8@2x.png" alt="" />
        </li>
        <li>
          <img src="@/assets/images/线下书店/xxsd-9@2x.png" alt="" />
        </li>
        <li>
          <img src="@/assets/images/线下书店/xxsd-10@2x.png" alt="" />
        </li>
        <li>
          <img src="@/assets/images/线下书店/xxsd-9@2x.png" alt="" />
        </li>
        <li>
          <img src="@/assets/images/线下书店/xxsd-12@2x.png" alt="" />
        </li>
      </ul>
    </section>
    <!-- 底部 -->
    <footer>
      <div class="three-img">
        <img src="@/assets/images/线下书店/xxsd-13@2x.png" alt="" />
        <img src="@/assets/images/线下书店/xxsd-14@2x.png" alt="" />
        <img src="@/assets/images/线下书店/xxsd15@2x.png" alt="" />
      </div>
      <img src="@/assets/images/线下书店/xxsd-16@2x.png" alt="" class="logo" />
    </footer>
  </div>
</template>

<script>
import router from "@/router";
import { reactive, ref } from "vue";
import { Toast } from "vant";
export default {
  setup() {
    const onClickLeft = () => router.go(-1);
    const showShare = ref(false);
    const options = [
      [
        { name: "微信", icon: "wechat" },
        { name: "朋友圈", icon: "wechat-moments" },
        { name: "微博", icon: "weibo" },
        { name: "QQ", icon: "qq" },
      ],
      [
        { name: "复制链接", icon: "link" },
        { name: "分享海报", icon: "poster" },
        { name: "二维码", icon: "qrcode" },
        { name: "小程序码", icon: "weapp-qrcode" },
      ],
    ];
    const onSelect = (option) => {
      Toast(option.name);
      showShare.value = false;
    };
    const onClickRight = () => (showShare.value = true);
    // 点击分享复制Url/分享海报
    const copyUrl = (option) => {
      // 辅助Url
      if (option.name === "复制链接") {
        navigator.clipboard.writeText(location.href);
        Toast.success("复制成功");
      }
      // 分享海报
    };
    // 轮播图列表
    const slideshowList = reactive([
      {
        imgUrl: require("@/assets/images/线下书店/xxsd-3@2x.png"),
      },
      {
        imgUrl: require("@/assets/images/线下书店/xxsd-16@2x(1).png"),
      },
    ]);
    return {
      onClickLeft,
      onClickRight,
      options,
      onSelect,
      showShare,
      slideshowList,
      copyUrl,
    };
  },
};
</script>

<style lang="less">
.offline-bookstore {
  font-family: PingFang SC;
  font-weight: bold;
  background-color: #efefef;
  // 分享
  .van-nav-bar__title {
    font-weight: bold;
  }
  .van-share-sheet__options {
    justify-content: center;
  }
  .left {
    width: 9.5px;
    height: 15px;
    margin-right: 9.5px;
  }
  // 返回
  .back {
    color: #000000;
    font-size: 14px;
  }
  .van-nav-bar__title {
    color: #000000;
    font-size: 15px;
  }
  .share {
    width: 16.5px;
    height: 16.5px;
  }
  // 轮播图
  .van-swipe {
    width: 375px;
    height: 453.5px;
    margin-bottom: 16px;
    img {
      width: 100%;
      height: 453.5px;
    }
  }
  .my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    text-align: center;
    background-color: #39a9ed;
  }
  .custom-indicator {
    position: absolute;
    right: 5px;
    bottom: 5px;
    padding: 2px 5px;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.1);
  }
  // 樊登书店
  .bookstore {
    position: relative;
    width: 327px;
    margin: 0 auto;
    background-color: #fff;
    padding: 31px 15px 26px;
    margin-bottom: 26px;
    h2 {
      text-align: center;
      margin-bottom: 18px;
      color: #000000;
      font-size: 21px;
    }
    .little-big-little {
      height: 4.5px;
      margin: 0 auto;
      margin-bottom: 13px;
      display: flex;
      align-items: center;
      justify-content: center;
      .little {
        width: 35.5px;
        height: 1px;
        background: #f3d964;
      }
      .big {
        width: 61px;
        height: 4.5px;
        background: #eeca43;
      }
    }
    // 服务中心
    .serve {
      width: 50%;
      margin: 0 auto;
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      grid-gap: 5px;
      margin-bottom: 233.5px;
      li {
        font-size: 14px;
        color: #b8b8b8;
        text-align: center;
      }
    }
    p {
      font-size: 17px;
      color: #989898;
      line-height: 25px;
      margin-bottom: 24.5px;
      &:last-of-type {
        margin-bottom: 221px;
      }
    }
    // 三张图片
    .three-pic {
      width: 344.5px;
      height: 178px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      position: absolute;
      top: 144.5px;
      left: 50%;
      transform: translateX(-50%);
      img {
        width: 108px;
        height: 160.5px;
        &.left {
          margin-right: 0;
        }
        &.center {
          width: 120px;
          height: 178px;
        }
        &.right {
          width: 108.5px;
          transform: translateX(1px);
        }
      }
    }
    // 大图
    figure {
      width: 375px;
      height: 221px;
      position: absolute;
      left: -24.5px;
      top: 760px;
      z-index: 0;
      img {
        height: 100%;
        width: 100%;
      }
    }
    .bottom {
      margin-bottom: 33px;
    }
    // 服务业态
    .manner {
      display: flex;
      justify-content: space-around;
      flex-wrap: wrap;
      li {
        width: 141px;
        height: 75px;
        margin-bottom: 5px;
        &:nth-of-type(3) {
          width: 288.5px;
          height: 75px;
        }
        img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
  // 底部
  footer {
    height: 285px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 5px;
    .three-img {
      margin-bottom: 48px;
      display: flex;
      justify-content: space-around;
      align-items: center;
      flex-wrap: wrap;
      img {
        width: 164.5px;
        height: 62px;
        &:first-of-type {
          width: 342.5px;
          height: 128.5px;
        }
      }
    }
    // logo
    .logo {
      width: 104.5px;
      height: 23px;
    }
  }
}
</style>
